package main

import (
	"fmt"
	"reflect"
)

// person struct 值类型
type person struct {
	Name string
	Age  uint8
}

func sum(a, b int) int {
	return a + b
}

func main() {
	var p person
	fmt.Println("age:", p.Age)
	var a *int
	fmt.Println(a)
	fmt.Println(reflect.ValueOf(a).IsNil())
	fmt.Println(reflect.ValueOf(a).IsValid())
	var b int = 10
	fmt.Println(&b, reflect.ValueOf(&b), reflect.ValueOf(&b).Elem())
	fmt.Printf("%p\n", &b)

	var c int = 20
	var d = &c
	*d = 21
	fmt.Println(c, *d)

	var e = func() {
	}
	fmt.Println(reflect.TypeOf(e))
	total := reflect.ValueOf(sum).Call([]reflect.Value{reflect.ValueOf(10), reflect.ValueOf(20)})
	fmt.Println(total, total[0].Int())
}
